﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;

namespace E_Tell
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
        }

        private void Main_Load(object sender, EventArgs e)
        {
        	List<string> lines = new List<string>();

            using (StreamReader r = new StreamReader(@".\SolarSystems.txt"))
            {
                string line;
                while ((line = r.ReadLine()) != null)
                {
	                lines.Add(line);
                }
            }

            AutoCompleteStringCollection systems = new AutoCompleteStringCollection();
            systems.AddRange(lines.ToArray());
            txtSolarSystem.AutoCompleteSource = AutoCompleteSource.CustomSource;
            txtSolarSystem.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            txtSolarSystem.AutoCompleteCustomSource = systems;

            txtSolarSystem.Focus();
        }

        private void lnkJoveLabs_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                System.Diagnostics.Process.Start("www.jovelabs.com/system/" + txtSolarSystem.Text);
            else
                MessageBox.Show("Please pick a system!");
        }

        private void lnkTrends_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                System.Diagnostics.Process.Start("www.jovelabs.com/system/" + txtSolarSystem.Text +"/trends");
            else
                MessageBox.Show("Please pick a system!");
        }

        private void lnkDotlan_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                System.Diagnostics.Process.Start("www.evemaps.dotlan.net/system/" + txtSolarSystem.Text);
            else
                MessageBox.Show("Please pick a system!");
        }

        private void lnkDatabase_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
             if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                 System.Diagnostics.Process.Start("http://eve.databased.at/ips.asp?opt=48NVMIECWP&system=" + txtSolarSystem.Text);
            else
                MessageBox.Show("Please pick a system!");
        }

        private void lnkBattleclinic_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                System.Diagnostics.Process.Start("http://eve.battleclinic.com/killboard/recent_activity.php?searchTerms=" + txtSolarSystem.Text);
            else
                MessageBox.Show("Please pick a system!");            
        }

        private void lnkEvekill_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                System.Diagnostics.Process.Start("http://eve-kill.net/?a=search&searchtype=system&searchphrase=" + txtSolarSystem.Text);
            else
                MessageBox.Show("Please pick a system!");   
        }

        private void lnkPilotBC_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPilot.Text))
            {
                string pilot = txtPilot.Text;
                if (pilot.Contains(" "))
                {
                    pilot = pilot.Replace(" ", "+");
                }
                System.Diagnostics.Process.Start("http://eve.battleclinic.com/killboard/combat_record.php?type=player&name=" + pilot);
            }
            else
                MessageBox.Show("Please pick a pilot!");   
        }

        private void lnkPilotEvekill_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPilot.Text))
            {
                string pilot = txtPilot.Text;
                if (pilot.Contains(" "))
                {
                    pilot = pilot.Replace(" ", "+");
                }
                System.Diagnostics.Process.Start("http://eve-kill.net/?a=search&searchtype=pilot&searchphrase=" + pilot);
            }
            else
                MessageBox.Show("Please pick a pilot!");   
        }

        private void lnkEveSearch_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPilot.Text))
            {
                string pilot = txtPilot.Text;
                if (pilot.Contains(" "))
                {
                    pilot = pilot.Replace(" ", "%20");
                }
                System.Diagnostics.Process.Start("http://eve-search.com/search/author/" + pilot);
            }
            else
                MessageBox.Show("Please pick a pilot!");
        }

        private void lnkEveboard_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPilot.Text))
            {
                string pilot = txtPilot.Text;
                if (pilot.Contains(" "))
                {
                    pilot = pilot.Replace(" ", "_");
                }
                System.Diagnostics.Process.Start("http://eveboard.com/pilot/" + pilot);
            }
            else
                MessageBox.Show("Please pick a pilot!");
        }

        private void txtPilot_KeyDown(object sender, KeyEventArgs e)
        {
            
            //if (e.KeyData == Keys.Enter && !String.IsNullOrEmpty(txtPilot.Text))
            //{
            //    lnkPilotBC_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkPilotEvekill_Click(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkEveSearch_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkEveboard_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
               
            //}
        }

        private void txtSolarSystem_KeyDown(object sender, KeyEventArgs e)
        {
            //if (e.KeyData == Keys.Enter && !String.IsNullOrEmpty(txtSolarSystem.Text))
            //{
            //    lnkJoveLabs_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkTrends_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkStatic_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkDotlan_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkDatabase_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkBattleclinic_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkEvekill_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //    lnkEveGate_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(new LinkLabel.Link()));
            //    Thread.Sleep(1500);
            //}
        }

        private void lnkStatic_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSolarSystem.Text))
                System.Diagnostics.Process.Start("  http://www.staticmapper.com/index.php?system=" + txtSolarSystem.Text);
            else
                MessageBox.Show("Please pick a system!");  
        }

        private void lnkEveGate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtPilot.Text))
            {
                string pilot = txtPilot.Text;
                if (pilot.Contains(" "))
                {
                    pilot = pilot.Replace(" ", "%20");
                }
                System.Diagnostics.Process.Start("https://gate.eveonline.com/Profile/" + pilot);
            }
            else
                MessageBox.Show("Please pick a pilot!");
        }

        private void pointFiveAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("75000000");
        }

        private void oneAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("150000000");
        }

        private void twoAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("300000000");
        }

        private void threeAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("450000000");
        }

        private void fourAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("600000000");
        }

        private void fiveAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("750000000");
        }

        private void sixAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("900000000");
        }

        private void sevenAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1050000000");
        }

        private void eightAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1200000000");
        }

        private void nineAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1350000000");
        }

        private void tenAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1500000000");
        }

        private void elevenAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1650000000");
        }

        private void twelveAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1800000000");
        }

        private void thirteenAUmsi_Click(object sender, EventArgs e)
        {
            Clipboard.SetText("1950000000");
        }

        private void btnAU_Click(object sender, EventArgs e)
        {
            ctxAuinKM.Show(btnAU, new Point(btnAU.Width,0));
        }
    }
}
